#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;
int main() {
	string st1;
	string st2;
	cin >> st1 >> st2;
	auto it1 = st1.begin();
	auto it2 = st2.begin();
	while (it1 != st1.end() && it2 != st2.end())
	{
		if (*it1 != '?' && *it1 != '*')
		{
			if (*it1 + 32 == *it2 || *it2 + 32 == *it1 || *it1 == *it2)
			{
				it1++;
				it2++;
			}
			else
			{
				cout << "false" << endl;
				return 0;
			}
		}
		if (*it1 == '?')
		{
			if (((*it2 >= '0' && *it2 <= '9') || (*it2 >= 'a' && *it2 <= 'z') || (*it2 >= 'A' && *it2 <= 'Z')))
			{
				it1++;
				it2++;
			}
			else
			{
				cout << "false" << endl;
				return 0;
			}
		}
		if (st1.size() < st2.size() && *it1 == '*')
		{
			if ((*it2 >= '0' && *it2 <= '9') || (*it2 >= 'a' && *it2 <= 'z') || (*it2 >= 'A' && *it2 <= 'Z'))
			{
				it1++;
				it2++;
			}
			else
			{
				cout << "false" << endl;
				return 0;
			}
		}
		else if (st1.size() >= st2.size() && *it1 == '*')
		{
			it1++;
		}
	}
	cout << "true" << endl;
	return 0;
}
